import React from 'react';
import { Checkbox } from 'antd';
import MultipleCheckbox from './_components/MultipleCheckbox';
import SingleCheckbox from './_components/SingleCheckbox';

const Index = (props) => {
  const propsKeys = Object.keys(props);

  if (propsKeys.includes('value')) {
    return propsKeys.includes('option') ? (
      <SingleCheckbox {...props} />
    ) : (
      <MultipleCheckbox {...props} />
    );
  }

  return 'DEPRECATED';
};

Object.keys(Checkbox.Group).forEach((item) => {
  if (!['defaultProps', 'propTypes', 'childContextTypes'].includes(item)) {
    Index[item] = Checkbox.Group[item];
  }
});
Index.displayName = 'Checkbox';
export default Index;
